 <!DOCTYPE html>
 <html>
     <head>
         <meta charset="utf-8"/>
         <title>数组</title>
     </head>
     <body>
         <script type="text/javascript">
            //  1.通过字面量创建数组
            var city = ["西安","渭南","咸阳","宝鸡"];
            console.log(city);
            //2、通过构造函数创建数组
            var arr = new Array("字符串",123,null,true,undefined,{name:"子明",age:18},[1,2,3,4,5,6,7,8]);
            console.log(arr);
            
            

            //循环数组
            var yidianzuData = { "code": 0, "message": null, "data": { "floors": [{ "id": 2, "name": "行政办公", "oid": 1, "status": null, "products": [{ "id": 7, "typeId": null, "oid": 1, "locUrl": null, "url": "https://edzimg.edianzu.com/2019/10/0843ae4722e4db7afd5cc4387e1232ebc.jpg", "title": "全新 惠普 ProOne 600 G5 ", "productId": 130022, "cdate": null, "mdate": null, "minRent": "99", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }, { "id": 8, "typeId": null, "oid": 2, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/06/85a832536d9bed368134645b5397ade0.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 ThinkPad L490 ", "productId": 126562, "cdate": null, "mdate": null, "minRent": "115", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }, { "id": 9, "typeId": null, "oid": 3, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/09/f57c4b1c5a5e90b6e393c9144827cd95.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 易点租  E44 Pro ", "productId": 129563, "cdate": null, "mdate": null, "minRent": "118", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }] }, { "id": 3, "name": "技术开发", "oid": 2, "status": null, "products": [{ "id": 10, "typeId": null, "oid": 1, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/05/da956645c811a0d0c87059dad50d24e8.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 惠普 青春版14S", "productId": 125523, "cdate": null, "mdate": null, "minRent": "138", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }, { "id": 12, "typeId": null, "oid": 2, "locUrl": null, "url": "https://edzimg.edianzu.com/2019/10/0cab29cad7979abd05772039f899bf827.jpg", "title": "全新 联想 M720s ", "productId": 129984, "cdate": null, "mdate": null, "minRent": "158", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }, { "id": 11, "typeId": null, "oid": 3, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/08/21d469b52ab117b53be2424709fd0f1c.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 易点租 E47 Pro", "productId": 128866, "cdate": null, "mdate": null, "minRent": "228", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }] }, { "id": 4, "name": "商务便携", "oid": 3, "status": null, "products": [{ "id": 13, "typeId": null, "oid": 1, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/07/53a676049ed46512f51f1733fa127452.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "ThinkPad X230 ", "productId": 127454, "cdate": null, "mdate": null, "minRent": "104", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }, { "id": 14, "typeId": null, "oid": 2, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/05/950f7695920a4c261a0dc71696cc3648.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 小米 Air ", "productId": 125459, "cdate": null, "mdate": null, "minRent": "258", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }, { "id": 15, "typeId": null, "oid": 3, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/04/01e1c4831b5cebda6f0f8b7291e47197.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 ThinkPad T490 ", "productId": 124738, "cdate": null, "mdate": null, "minRent": "288", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }] }, { "id": 5, "name": "图形处理", "oid": 4, "status": null, "products": [{ "id": 18, "typeId": null, "oid": 1, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/05/ec8eb2210ba6ab4fbb57b70d3714e59a.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 惠普 青春版14S ", "productId": 125525, "cdate": null, "mdate": null, "minRent": "178", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }, { "id": 16, "typeId": null, "oid": 2, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/07/527abfe71d740594bf4e4f93e4352615.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 易点租  P44 ", "productId": 126658, "cdate": null, "mdate": null, "minRent": "338", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }, { "id": 17, "typeId": null, "oid": 3, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/05/4288a05bd38531ded00152e2ca627805.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 苹果 MacBook Pro  ", "productId": 125897, "cdate": null, "mdate": null, "minRent": "738", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }] }, { "id": 6, "name": "外设配件", "oid": 5, "status": null, "products": [{ "id": 20, "typeId": null, "oid": 1, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/09/87dfc9075cff7c9387d8b3400465fbc9.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 Apple iPad ", "productId": 129752, "cdate": null, "mdate": null, "minRent": "118", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }, { "id": 19, "typeId": null, "oid": 2, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/09/d7486b3b298d552d01172b54bc25ec8c.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 小米电视4C ", "productId": 129180, "cdate": null, "mdate": null, "minRent": "178", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }, { "id": 21, "typeId": null, "oid": 3, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/09/c4c771660494b913560ff0b20464a27a.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 Apple iPhone 11 Pro Max", "productId": 129841, "cdate": null, "mdate": null, "minRent": "938", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }] }], "loopLogo": [{ "id": 10, "logo": "https://edzimg.edianzu.com/2019/09/03e365e96fcaa2cb529c4bb588d5a97b8.jpg", "url": "https://m.edianzu.com/wap/category/84?sort=0&errorCheck=1&title=G5&page=1", "title": null, "status": false, "oid": 1, "cdate": null, "mdate": null, "belongId": null }, { "id": 15, "logo": "https://edzimg.edianzu.com/2019/09/05fc9a76b74e7cf599ae5c435b6771b2d.jpg", "url": "https://m.edianzu.com/wap/category/all?title=M720s&sort=2&errorCheck=1&page=1", "title": null, "status": false, "oid": 2, "cdate": null, "mdate": null, "belongId": null }, { "id": 11, "logo": "https://edzimg.edianzu.com/2019/10/0040fb485c008f3a0046bcf3d93267888.jpg", "url": "https://m.edianzu.com/wap/category/all?title=3070&sort=2&errorCheck=1&page=1", "title": null, "status": false, "oid": 3, "cdate": null, "mdate": null, "belongId": null }, { "id": 12, "logo": "https://edzimg.edianzu.com/2019/09/096ca59cb04b7de4ce5dae07893446b63.jpg", "url": "https://m.edianzu.com/wap/category/all?title=L490&errorCheck=1", "title": null, "status": false, "oid": 4, "cdate": null, "mdate": null, "belongId": null }, { "id": 13, "logo": "https://edzimg.edianzu.com/2019/09/051881dee492466ba1a2dc64503510ab4.jpg", "url": "https://m.edianzu.com/wap/category/all?title=iphone11&sort=2&errorCheck=1&page=1", "title": null, "status": false, "oid": 5, "cdate": null, "mdate": null, "belongId": null }, { "id": 14, "logo": "https://edzimg.edianzu.com/2019/09/0918b2a195186d3464dc63090b4c773fa.jpg", "url": "https://m.edianzu.com/wap/category/all?title=L390&sort=2&errorCheck=1&page=1", "title": null, "status": false, "oid": 6, "cdate": null, "mdate": null, "belongId": null }, { "id": 9, "logo": "https://edzimg.edianzu.com/2019/09/04c314c9052bf3e592cd92594cc23aab5.jpg", "url": "/wap/product/129563", "title": null, "status": false, "oid": 7, "cdate": null, "mdate": null, "belongId": null }], "hotModel": [{ "id": 3, "typeId": null, "oid": 1, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/06/4a4ba2f3d7203a68ccb46068c413862f.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 ThinkPad L490 ", "productId": 126538, "cdate": null, "mdate": null, "minRent": "95", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }, { "id": 2, "typeId": null, "oid": 2, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/05/d5e2852834dc1a7cb67171e4c77adc77.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 惠普 青春版14S ", "productId": 125522, "cdate": null, "mdate": null, "minRent": "128", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }, { "id": 1, "typeId": null, "oid": 3, "locUrl": null, "url": "https://edzimg.edianzu.com/2019/10/03db1b39091b124b025d7e7144b3cec70.jpg", "title": "全新 联想  M720s ", "productId": 129983, "cdate": null, "mdate": null, "minRent": "128", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }, { "id": 6, "typeId": null, "oid": 4, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/05/262d6fcc132d5a00848efe8212895d8f.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 惠普 星系列 Pavilion 13 ", "productId": 125528, "cdate": null, "mdate": null, "minRent": "148", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }, { "id": 4, "typeId": null, "oid": 5, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/08/3c6d39c9d1251807297d65152d2ff574.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 易点租 E45 Pro ", "productId": 128706, "cdate": null, "mdate": null, "minRent": "158", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }, { "id": 5, "typeId": null, "oid": 6, "locUrl": null, "url": "https://edzimg.edianzu.com/product/2019/05/362ba6b36cde10b1e7edb7da734ff7f7.jpg?x-oss-process=image/resize,m_fill,h_380,w_380", "title": "全新 ThinkPad L390", "productId": 125395, "cdate": null, "mdate": null, "minRent": "188", "isSale": false, "sale": false, "salePrice": null, "isHaveStock": 1 }] } }

            console.log(yidianzuData);

            var arr = yidianzuData.data.floors;
            console.log(arr);
            for(var i = 0;i < arr.length;i++){
                for(var j=0 ;j<arr[i].products.length;j++){

                    document.write("<img src='"+arr[i].products[j].url+"'><h2>"+arr[i].products[j].title+"</h2>");
                }
            } 


         </script>
     </body>
 </html>